package com.bykj.property.mapper.provider;

import com.bykj.property.controller.vo.request.NewsSendPageRequest;
import com.bykj.property.controller.vo.request.RepairPersonPageRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author yiming
 * @title: RepairPersonSql
 * @projectName property
 * @description: TODO
 * @date 2019/6/3017:42
 */
public class RepairPersonSql {
    public String getSql(RepairPersonPageRequest pageRequest){
        return new SQL() {
            {
                SELECT("*");
                FROM("repair_person");
                if(!StringUtils.isEmpty(pageRequest.getRepairPersonNumber())) {
                    pageRequest.setRepairPersonNumber("%"+pageRequest.getRepairPersonNumber()+"%");
                    WHERE("repair_person_number like #{repairPersonNumber}");
                }
                if(!StringUtils.isEmpty(pageRequest.getRepairPersonName())) {
                    pageRequest.setRepairPersonName("%"+pageRequest.getRepairPersonName()+"%");
                    WHERE("repair_person_name like #{repairPersonName}");
                }





            }
        }.toString();

    }
}
